Learn how to index data to Algolia daily.
variants
attribute.image_groups
aren’t stored in each variant.
For a given color, all size variations have the same image_groups
.
Instead of duplicating image_groups
in all variants, only one is stored for each color: in the colorVariations
attribute.
The Algolia integration for Salesforce B2C Commerce uses a variant’s color
information to determine which image to display.example.com
clothing
en_US
, fr_FR
USD
, EUR
short_description
, long_description
, brand
, color
, size
example-com__clothing__products__en_US
example-com__clothing__products__fr_FR
example-com__clothing__categories__en_US
example-com__clothing__categories__fr_FR
${hostname}__${site_id}
prevents accidental name collisions between your environments. It makes using a single Algolia application with multiple sandboxes or sites completely safe.
You can always change the prefix with the Algolia_IndexPrefix custom site preference.attributeListOverride
job step parameter, which overrides both the base attributes and any additional product attributes configured for that job.
Attribute | Description |
---|---|
name | Name of the product |
primary_category_id | Primary category ID |
categories | Array of categories assigned to the product, with all their parent categories |
url | URL pointing to the product’s PDP (Product Detail Page). |
image_groups | Array of product image URLs |
in_stock | true if the number of products available is greater than the InStock Threshold you’ve set, false otherwise |
price | Product price |
short_description
, long_description
, then expand the list according to your use case (for example brand
, color
, size
).
Attribute | Description |
---|---|
EAN | The European Article Number of the product. |
UPC | The Universal Product Code of the product. |
brand | The brand of the product. |
bundle | Identifies if this product instance is a product bundle. |
bundled | Identifies if this product instance is bundled within at least one product bundle. |
bundledProducts | A collection containing all products that participate in the product bundle. |
color | The product’s color. |
colorVariations | An array containing an entry for each color variation. Each entry contains the image_groups of the variation, the variationUrl , and the variation color . |
long_description | Full description of product. |
lsImage | Expose the first product image at the root of the Algolia record. Used by the Looking Similar widget. |
manufacturerName | The name of the product manufacturer. |
manufacturerSKU | The value of the manufacturer’s stock keeping unit. |
master | Identifies if this product instance is a product master. |
masterID | ID of the master product. |
online | The online status of the product. This is determined based on the product’s online status flag, and the onlineFrom and onlineTo dates. |
optionProduct | Identifies if the product has options. |
pageDescription | Returns product’s page description in the default locale. |
pageKeywords | The product’s page keywords in the default locale. |
pageTitle | The product’s page title in the default locale. |
productSetProduct | true if this product is part of any product set, otherwise false . |
productSet | Returns true if the instance represents a product set, otherwise false . |
promotionalPrice | Product’s lowest promotional price, from the currently active promotions. |
refinementColor | Search Refinement Bucket of the color . |
searchable | Identifies if the product is searchable. |
size | The product’s size. |
short_description | Short description of product. |
unit | The products sales unit. |
variant | Identifies if this product instance belongs to a product master. |
newArrivalsCategory | If this product is part of the new arrivals category. |
newArrivalsCategory
attribute to the Additional Product Attributes list to send it to Algolia.newArrivalsCategory
as an attribute for faceting in the Algolia dashboard.variants
array (for the product-level record model)activeData.impressionsDay
and activeData.revenueDay
, they will be indexed in Algolia as:
attribute
property.custom.<attribute_name>
.productAttributesConfig.js
file in the int_algolia/cartridge/configuration/
directory.
For an example, see this file in the cartridge code.
This file must export a configuration object. The keys of this object are the name of the attributes in your Algolia records.
Each key holds an object with the following properties:
Property Name | Type | Description |
---|---|---|
attribute | string or function | The attribute declaration. It can be: - The full path to the SFCC Product attribute name, separated by dots. - A function that takes the current product as parameter and returns data to be indexed in the Algolia record. |
localized | boolean | (Optional, default: false ) Should be true if the attribute is localized. |
variantAttribute | boolean | (Optional, default: false ) Only used for the product-level record model, to identify attributes indexed in the variants array. |
computedFromBaseProduct | boolean | (Optional, default: false ) Only used for the variant-level record model, to identify attributes computed once from the base product, and indexed into each variant. |
attribute
property lets you declare attributes with their direct name (simple values like name
, brand
, etc.) or their “path”, for nested values with direct access.
For example, you can access the revenueWeek
attribute of a product’s activeData
object by declaring activeData.revenueWeek
.
Other values are more complex and must be computed.
For that, the attribute
property accepts a function to define how to export such complex attributes.
id
primary_category_id
__primary_category
categories
variants
productRecordCustomizer.js
file in the int_algolia/cartridge/configuration/
directory.
This permits to do post-processing operations on the final records, after fetching all attributes.
This file must export a function that takes as parameter the final Algolia record and does modifications on it:
AlgoliaProductPriceIndex_v2
and AlgoliaProductInventoryIndex_v2
attributeListOverride
parameter.
Additional attributes can increase the job’s total runtime depending on the complexity of retrieving the attribute:
AlgoliaProductPriceIndex_v2
: price
AlgoliaProductInventoryIndex_v2
: in_stock
activeData.revenueWeek
to index revenue week data or availabilityModel.inStock
to index the in-stock status of a product.
productAttributesConfig.js
), declare each field with their path in the attribute
property:
revenueWeek
.
AlgoliaProductIndex_v2
job.
revenueData
.
productAttributesConfig.js
), add a revenueData
declaration with the attribute
property being a function that returns the data to index.
revenueData
.
AlgoliaProductIndex_v2
job.